home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
ead
/
ead15.dms
/
ead15.adf
/
Basic
/
MadRace
< prev
next >
Wrap
Text File
|
1989-04-30
|
4KB
|
152 lines
' M A D R A C E !
' by Paolo Scalabrini
' Via al Bricco 11/7
' 16014 Campomorone (GE)
' Tel. (010) 78.10.29
CLEAR ,10000
RANDOMIZE TIMER
'definizione variabili
DIM PrendoVideo%(96)
DIM EndRace%(546):AccX=20:AccY=20
causa$="":X1=150:Y1=140:pneum%=110:X2=130:Y2=10:Punti%=0:tempo%=0
x%=0:y=0:ww%=0:x$="":sprdef$="":sprdef1$="":sprdef2$="":VelX=20:VelY=4
SCREEN 1,320,256,5,1
WINDOW 2,"Mad Race! by Paolo Scalabrini",,0,1
PALETTE 0,.22,.54,.14
LINE (120,0)-(200,8),1,bf
COLOR 0,1:LOCATE 1,16:PRINT "* finish *"
COLOR 1,0
GET (120,0)-(200,8),EndRace%
GOSUB DefSprites
Inizio:
CLS:LOCATE 12,10:PRINT "P R E P A R A T I !"
FOR x%=440 TO 4400 STEP 40:SOUND x%,.5:NEXT
CLS:LINE (120,0)-(200,256),24,bf 'Disegna la strada
LINE (120,0)-(128,256),12,bf
LINE (192,0)-(200,256),12,bf
FOR y=-15 TO 256 STEP 16
LINE (158,y)-(162,y+12),1,bf
NEXT
OBJECT.X 1,X1:OBJECT.Y 1,Y1 'posiziona gli sprite
OBJECT.X 2,X2:OBJECT.Y 2,Y2
OBJECT.ON:OBJECT.START:GOSUB gomme
Loop:
COLLISION ON
ON COLLISION GOSUB GestColl 'verifica collisioni
GOSUB MuoviStrada
GOSUB GestJoy
GOSUB ControlAuto
Punti%=Punti%+1:tempo%=tempo%+1
IF tempo% > 1000 THEN GOSUB FineGara:GOTO Restart
IF causa$<>"" THEN GOSUB Incidente:GOTO Restart
GOTO Loop
MuoviStrada:
GET (158,237)-(162,241),PrendoVideo%
SCROLL (158,0)-(162,253),0,4
PUT (158,0),PrendoVideo%,OR
RETURN
DefSprites:
FOR x%=0 TO 52
READ ww%
sprdef$=sprdef$+MKI$(ww%)
NEXT
sprdef1$=sprdef$+MKI$(&HDF)+MKI$(&H0)+MKI$(&HF33)
OBJECT.SHAPE 1,sprdef1$
sprdef2$=sprdef$+MKI$(&HDF)+MKI$(&H0)+MKI$(&H33F)
OBJECT.SHAPE 2,sprdef2$
RETURN
DATA &h0000,&h0000,&h0000,&h0000,&H0000,&H0002,&H0000,&H0010
DATA &h0000,&h0014,&h0019,&h0003,&h0000,&h0e70,&h324c,&h6a56
DATA &h2a54,&h2244,&h3ffc,&h7ffe,&h7ffe,&h7ffe,&h3ffc,&h3ffc
DATA &h3ffc,&h23c4,&h1ff8,&h0000,&h0000,&h0000,&h0000,&h0000
DATA &h0000,&h0ff0,&h3ffc,&h7ffe,&hffff,&hffff,&hf00f,&h6006
DATA &h7ffe,&h7ffe,&hffff,&he007,&hf00f,&hffff,&h1ff8,&h0000
DATA &h0000,&h0000,&h0000,&h0000,&h0000
GestJoy:
AccX=40*STICK(2)
AccY=30*STICK(3)
GOSUB ControlPos
GOSUB SetSpritePos
RETURN
SetSpritePos:
OBJECT.VX 1,AccX:OBJECT.VY 1,AccY
OBJECT.VX 2,VelX:OBJECT.VY 2,VelY
RETURN
ControlPos:
IF OBJECT.X (1)<=129 THEN OBJECT.X 1,128:GOSUB gomme
IF OBJECT.X (1)=>181 THEN OBJECT.X 1,180:GOSUB gomme
IF OBJECT.Y (1)<=120 THEN OBJECT.Y 1,120
IF OBJECT.Y (1)=>220 THEN OBJECT.Y 1,220
RETURN
gomme:
IF pneum%<110 THEN SOUND 1500,.2,255
pneum%=pneum%-10
LOCATE 5,1:PRINT USING "Gomme: ###";pneum%
IF pneum%<=0 THEN causa$="Hai bucato gli pneumatici"
RETURN
Incidente:
OBJECT.STOP:COLLISION OFF
FOR x%=3000 TO 0 STEP -50:SOUND x%,.5:NEXT
FOR x%=1 TO 2000:NEXT
OBJECT.OFF
CLS
FOR x%=1 TO 16
COLOR colore
colore=(colore+1) MOD 2
LOCATE 10,8:PRINT causa$
SOUND 440,2*colore
FOR rit=1 TO 300:NEXT
NEXT
COLOR 1
RETURN
Restart:
CLS
LOCATE 9,7:PRINT "Hai totalizzato punti:";Punti%
LOCATE 11,9:LINE INPUT "Giochi ancora? [S/N]";x$
x$=UCASE$(x$)
IF x$="N" THEN SYSTEM ELSE RUN
ControlAuto:
VelY=RND*50
IF OBJECT.Y (2)>=220 THEN
OBJECT.Y 2,20
Punti%=Punti%+15
GOSUB suono
END IF
NewVelX=(RND*60)+10:IF SGN(VelX)=-1 THEN NewVelX=-NewVelX:VelX=NewVelX
IF OBJECT.X (2)<=129 THEN VelX=-VelX:OBJECT.X 2,130
IF OBJECT.X (2)>=175 THEN VelX=-VelX:OBJECT.X 2,173
GOSUB SetSpritePos
RETURN
GestColl:
IF COLLISION(2) THEN
PALETTE 0,1,0,0
SOUND 1000,3
FOR x%=1 TO 200:NEXT
PALETTE 0,.22,.54,.14
causa$="Hai scontrato l'altra auto"
END IF
RETURN
suono:
FOR x%=100 TO 3000 STEP 100:SOUND x%,.2:NEXT:RETURN
FineGara:
OBJECT.STOP:COLLISION OFF
PUT (120,0),EndRace%,PSET
FOR rit=1 TO 800:NEXT
FOR move=OBJECT.Y(1) TO 10 STEP -.1
OBJECT.Y 1,move
NEXT
FOR x%=1 TO 3:FOR y=40 TO 5000 STEP 100:SOUND y,.25:NEXT y,x%
OBJECT.OFF
Punti%=Punti%+1000
RETURN